$("#page-container").text = window.location;

function tst_uname(uname){
	var okuname = uname.search(/^[a-zA-Z]+$/);   
	
	if (okuname != 0){
		$("#logunameerr").css("visibility","visible");
		return false;
	} else {
		$("#logunameerr").css("visibility","hidden");
		return true;
	}
};

function tst_pass(pass){
	
	if(pass == ""){
		$("#logpasserr").css("visibility","visible");
		return false;
	}
	else{	
		$("#logpasserr").css("visibility","hidden");
		return true;
	}
};

function validiraj(event){

	var uname = document.getElementById("loguname").value;
	var pass  = document.getElementById("logpass" ).value;

	var okuname = tst_uname(uname);
	var okpass = tst_pass(pass);
	
	if(!okuname || !okpass){
		event.preventDefault();
		return false;
	}else{
		
		return true;
	}
};

var gumb = document.getElementById("log");
gumb.addEventListener( "click", validiraj, false);
